<template>
  <div class="menu-box">
    <span
      @click="handleClick(index)"
      v-for="(item, index) in list"
      :key="index"
      :class="{active:nowIndex==index}"
      >{{ item }}</span
    >
  </div>
</template>

<script>
export default {
  data() {
    return {
      nowIndex: 0,
      list: ["正在抢购", "上新预告"],
    };
  },
  methods: {
    handleClick(index) {
      this.nowIndex = index;
    },
  },
};
</script>

<style scoped>
.menu-box {
  width: 100%;
  height: 100px;
  background: linear-gradient(
    to bottom,
    #eb5529,
    #eb5528,
    #ec6b2c,
    #ee8031,
    #f1a039,
    #f4e3ba
  );
}
span {
  color: white;
  line-height: 50px;
  /* display: block; */
  margin-left: 15px;
}
.active {
  font-weight: 700;
}
</style>